public class Student {
    public String name;
    public int age;

    //构造方法
    Student() {
        System.out.println("不带参数的构造方法");
    }
    Student(String name,int age){
        System.out.println("带两个参数的构造方法");
    }
    //
    public void setStudent(String name,int age){
        this.name = name;
        this.age = age;
    }

    public void printStudent(){
        System.out.println(this.name+" - "+this.age);
    }

    public static void main(String[] args) {
        Student student = new Student();
        Student student1 = new Student("德川",18);
        //实例化对象时，编译器自动调用构造方法
        student.setStudent("我修院",24);
        //student.printStudent();
    }
}
